package com.godyao.mall.core.audit;

import com.godyao.mall.core.utils.OauthUtils;
import org.springframework.data.domain.AuditorAware;
import org.springframework.stereotype.Component;

import java.util.Optional;

/**
 * @author godyao
 * @date 2022/4/5
 */
public class MyAuditorAwaree implements AuditorAware<String> {
    @Override
    public Optional<String> getCurrentAuditor() {
        return Optional.of(OauthUtils.getCurrentUser().getUsername());
    }
}
